cmake_minimum_required(VERSION 3.8)
project(odometry_chassis)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

set(CMAKE_CXX_STANDARD 17)

# 设置头文件路径
include_directories(${CMAKE_SOURCE_DIR}/include/H1)
include_directories(${CMAKE_SOURCE_DIR}/include/H1/ZCM_Data)
include_directories(${CMAKE_SOURCE_DIR}/)
include_directories(${CMAKE_SOURCE_DIR}/include)


# 查找预编译的库
find_library(ROBOT_CORE_LIB robot_core PATHS ${CMAKE_SOURCE_DIR}/lib/H1 NO_DEFAULT_PATH)


# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_ros REQUIRED)



add_executable(odometry_chassis_node src/odometry_chassis.cpp src/odometry_chassis_node.cpp)
target_link_libraries(odometry_chassis_node ${ROBOT_CORE_LIB} zcm)
ament_target_dependencies(odometry_chassis_node rclcpp geometry_msgs nav_msgs tf2 tf2_ros)

install(TARGETS
  odometry_chassis_node
  DESTINATION lib/${PROJECT_NAME})
  
if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()

install(DIRECTORY launch config
  DESTINATION share/${PROJECT_NAME}
)
